package com.fadadianqi.logistics.admin.ticket.dao.ibatis;

import com.fadadianqi.logistics.admin.ticket.dao.PrizeDAO;
import com.fadadianqi.logistics.admin.ticket.model.Prize;
import com.fadadianqi.commons.GenericDAOSuport;
import com.yeqiangwei.commons.util.Pagination;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class PrizeDAOImpl extends GenericDAOSuport<String, Prize> implements
        PrizeDAO {

    @Override
    protected Class<?> getObjectClass() {
        return Prize.class;
    }

    @Override
    protected String getTableName() {
        return "ticket_prize";
    }

    @Override
    public List<Prize> findByTypeAndNotWithdraw(int type) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("type", type);
        map.put("withdraw", Boolean.FALSE);
        return super.findByPropertys(map);
    }

    @Override
    public List<Prize> findAllWithNotDraw(Pagination pagination) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("withdraw", Boolean.FALSE);
        return super.findByPropertys(map);
    }


}
